﻿package game.exchangeddata 
{
	/**
	 * ...
	 * @author Doan Nguyen Thuy Nha Truc (Bamboo)
	 */
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import game.constants.ConstData
	import game.events.EventData;
	public class BetStatusInfo extends EventDispatcher
	{
		public var betRecNo:String;
		public var dateNo:String;
		public var timeNo:String;
		public var tableNo:String;
		public var gameSetNo:String;
		public var betCodeNo:String;
		public var resultNo:String;
		public var amountNo:String;
		public var winNo:String;
		public var commissionAmountNo:String;
		public var pageNum:uint;
		private var breakLine:String = "\n";
		public var addPage:Boolean = true;

		public function BetStatusInfo() 
		{
			
		}
		
		public function init():void {
			betRecNo = "";
			dateNo = "";
			timeNo = "";
			tableNo = "";
			gameSetNo = "";
			betCodeNo = "";
			resultNo = "";
			amountNo = "";
			winNo = "";
			commissionAmountNo = "";
		}
		
		public function resultRecentBet(result:String):void {
			init();
			var temp:Array = result.split("&");
			this.pageNum = temp[0];
			var tempStr:String = temp[1].substr(ConstData.LEN_SUCCESS_RESULT, temp[1].length - 1);
			var temArr:Array = tempStr.split("*");
			var MAX_NUM_ROW:int = parseInt(temArr[0]);
			if (temArr.length == 0)
				return;
			var index:int = 1;
			for(var i:int = 1; i <= MAX_NUM_ROW; i++)
			{
				betRecNo += temArr[index] + breakLine;	
				dateNo += temArr[index + 1] + breakLine;	
				timeNo += temArr[index + 2] + breakLine;	
				tableNo += temArr[index + 3] + breakLine;	
				gameSetNo += temArr[index + 4] +breakLine;
				betCodeNo += temArr[index + 5] + breakLine;
				resultNo += temArr[index + 6] + breakLine;
				amountNo += temArr[index + 7] + breakLine; 
				winNo += temArr[index +8] + breakLine;
				commissionAmountNo += temArr[index + 9] + breakLine;
				index += 10;		
			}
			trace("resultRecentBet===========");
			dispatchEvent(new Event(EventData.UPDATE_BET_STATUS, true));
		}
	}

}